import 'package:backend.core/core/domain/entities/google_play/google_play_transaction_revocation_source.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_transaction_revocation_source.dart';

abstract class CreateGooglePlayTransactionRevocationSourceFromApiOne {
  GooglePlayTransactionRevocationSource call({
    required GooglePlayApiTransactionRevocationSource apiRevocationSource,
  });
}

class CreateGooglePlayTransactionRevocationSourceFromApiOneImpl
    implements CreateGooglePlayTransactionRevocationSourceFromApiOne {
  const CreateGooglePlayTransactionRevocationSourceFromApiOneImpl();

  @override
  GooglePlayTransactionRevocationSource call({
    required GooglePlayApiTransactionRevocationSource apiRevocationSource,
  }) {
    switch (apiRevocationSource) {
      case GooglePlayApiTransactionRevocationSource.user:
        return GooglePlayTransactionRevocationSource.user;
      case GooglePlayApiTransactionRevocationSource.developer:
        return GooglePlayTransactionRevocationSource.developer;
      case GooglePlayApiTransactionRevocationSource.google:
        return GooglePlayTransactionRevocationSource.google;
    }
  }
}
